﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace diploma.test.core
{
    public class DifficultQuestion : Question
    {
        List<string> answer;
        List<string> options;

        public DifficultQuestion(string _question, IEnumerable<string> _answer, IEnumerable<string> _options)
            : base(_question)
        {
            this.answer = new List<string>(_answer);
            this.options = new List<string>(_options);
        }

        public override QuestionTypes Type
        {
            get
            {
                return QuestionTypes.Difficult;
            }
        }


        public string[] Options
        {
            get
            {
                return options.ToArray();
            }
        }

        public int[] RightOptions
        {
            get
            {
                List<int> roptions = new List<int>();
                foreach (string item in answer)
                {
                    int q = this.options.BinarySearch(item.Trim());
                    if (this.options[0] == item) q = 0;
                    roptions.Add(q);
                }
                roptions.Sort();
                return roptions.ToArray();
            }
        }
    }
}
